using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerWallSlideState : PlayerState
{
    public PlayerWallSlideState(PlayerStateMachine _stateMachine, Player _player, string _animBoolName) : base(_stateMachine, _player, _animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();

        if (Input.GetKeyDown(KeyCode.LeftShift) && player.Skill.Dash.dashUnlocked)
        {
            player.Skill.Dash.CanUseSkill();
            player.SetDashDir();
            stateMachine.ChangeState(player.DashState);
            return;
        }

        if (player.IsWallChecked() == false)
            stateMachine.ChangeState(player.AirState);

        if (Input.GetKeyDown(KeyCode.W))
        {
            stateMachine.ChangeState(player.WallJump);
            return;
        }



        if (x_Input !=0 && player.FacingDir !=x_Input)
            stateMachine.ChangeState(player.IdleState);

        if(y_Input < 0)
            rb.velocity = new Vector2(0,rb.velocity.y);
        else
            rb.velocity = new Vector2(0,rb.velocity.y * 0.7f);

        if(player.isGroundDetected())
            stateMachine.ChangeState(player.IdleState);
    }
}
